
{***********************************************************}
{                                                           }
{      Luxena Class Library                                 }
{                                                           }
{      System Utilities                                     }
{                                                           }
{      Copyright (c) 2001-2008 Luxena Software Company      }
{      http://www.luxena.com                                }
{      e-mail: support@luxena.com                           }
{                                                           }
{***********************************************************}

unit LXSysUtils;

{$I lx.inc}

interface

function LXFormatMaskText(const EditMask: string; const Value: string): string;
procedure LXRaiseLastOSError;
procedure LXStrPCopy(Dest: PChar; const Source: string);
procedure LXStrPLCopy(Dest: PChar; const Source: string; MaxLen: Integer);

implementation

uses
  SysUtils, {$IFDEF D6}MaskUtils{$ELSE}Mask{$ENDIF};

function LXFormatMaskText(const EditMask: string; const Value: string): string;
begin
  Result := FormatMaskText(EditMask, Value);
end;

procedure LXRaiseLastOSError;
begin
{$IFDEF D6}
  RaiseLastOSError;
{$ELSE}
  RaiseLastWin32Error;
{$ENDIF}
end;

procedure LXStrPCopy(Dest: PChar; const Source: string);
begin
  if Source <> '' then
  begin
    Move(PChar(Source)^, Dest^, Length(Source));
    Inc(Dest, Length(Source));
  end;
  Dest^ := #0;
end;

procedure LXStrPLCopy(Dest: PChar; const Source: string; MaxLen: Integer);
begin
  if Length(Source) < MaxLen then
    MaxLen := Length(Source);
  if MaxLen > 0 then
  begin
    Move(PChar(Source)^, Dest^, MaxLen);
    Inc(Dest, MaxLen);
  end;
  Dest^ := #0;
end;


end.